<?php
use mdm\admin\components\MenuHelper;
use backend\components\helper\Menu;
use backend\components\helper\EasyHtml;
use yii\helpers\StringHelper;

/* @var $this \yii\web\View */
/* @var $content string */
$menuHtml = Menu::getMenuInfo(MenuHelper::getAssignedMenu(Yii::$app->user->id, null, [Menu::class,'format']));
?>
<header class="main-header">
    <?= EasyHtml::a('<span class="logo-mini">' . app()->id . '</span><span class="logo-lg">' . app()->name . '</span>', app()->homeUrl, ['class' => 'logo']) ?>
    <nav class="navbar navbar-static-top" role="navigation">
        <a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
            <span class="sr-only">Toggle navigation</span>
        </a>
        <div class="module-menu-list"><?=$menuHtml[0];?></div>

        <div class="navbar-custom-menu">
            <ul class="nav navbar-nav">
                <li class="dropdown user user-menu">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <img src="<?=userInfo('admin_avatar')??'/images/avatar.png'?>" class="user-image" alt="User Image"/>
                        <span class="hidden-xs"><?=StringHelper::truncate(userInfo('nickname')??userInfo('username'),5)?></span>
                    </a>
                    <ul class="dropdown-menu header-tools">
                        <li>
                            <?= EasyHtml::iconLink(
                                '选择主题',
                                null,
                                ['id'=>'change-theme','class' => 'btn btn-link','icon'=>'list-ul']
                            ) ?>
                        </li>
                        <li>
                            <?= EasyHtml::iconLink(
                                '个人信息',
                                ['/site/user'],
                                ['class' => 'btn btn-link','icon'=>'user']
                            ) ?>
                        </li>
                        <li>
                            <?= EasyHtml::iconLink(
                                '修改密码',
                                ['/site/password'],
                                ['id'=>'change-password','class' => 'btn btn-link','icon'=>'pencil']
                            ) ?>
                        </li>
                        <li>
                            <?= EasyHtml::iconLink(
                                '退出登录',
                                ['/site/logout'],
                                ['data-method' => 'post', 'class' => 'btn btn-link','icon'=>'power-off']
                            ) ?>
                        </li>
                    </ul>
                </li>
            </ul>
        </div>
    </nav>
</header>
<aside class="main-sidebar">
    <section class="sidebar"><?=$menuHtml[1];?></section>
</aside>